<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var times =0
        var st
        const name=['郑玮喆','庄云','廖治先','郑文源','戴俊锋','陈昊童','谢金金','占志新','张淑芳','刘永潘','廖柏成','郑宗帅','李韦峰','吴欣燕','陈梅香','陈立智','袁贵森','赵浩敏',
                    '林世涛','罗启恒','卢国建','黄柱菘','陈鹏','张耀仁','陈华伟','张正豪','韦仲晓','黄富贵','陆建锋','曾德森','吴文龙','陆利群','黄雄','王世财','张先杰','胡基耀',
                    '马鑫涛','李涛','杨凌翔','罗此东','唐皓颖','白婉婷']
        function fn() {
            times++
            for (let i = 1; i <= 42; i++) {
                var stu_num = document.getElementById(i);
                stu_num.style.backgroundColor = 'white';
            }
            var num =Math.ceil(Math.random()*42)
            var stu_num = document.getElementById(num)
            stu_num.style.backgroundColor='red'
            document.getElementById('nu').innerText = '恭喜:' + name[num-1]+'上来脑力训练一下';
            if(times>=20 && num!=3){
                document.getElementById('nu').innerText = '恭喜:' + stu_num.innerText+'上来脑力训练一下';
                clearInterval(st);
            }
        }
        function start() {
            times=0
            st=setInterval(fn,100)
        }
    </script>
    <style>
        table{
            margin: 0px auto;
            width: 500px;
            height: 500px;
            border-spacing: 0;
        }
        td{
            border: solid 1px black;
            width: 100px;
            height: 100px;
            text-align: center;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <td id="1">郑玮喆</td>
            <td id="2">庄云</td>
            <td id="3">廖治先</td>
            <td id="4">郑文源</td>
            <td id="5">戴俊锋</td>
            <td id="6">陈昊童</td>
            <td id="7">谢金金</td>
        </tr>
        <tr>
            <td id="8">占志新</td>
            <td id="9">张淑芳</td>
            <td id="10">刘永潘</td>
            <td id="11">廖柏成</td>
            <td id="12">郑宗帅</td>
            <td id="13">李韦峰</td>
            <td id="14">吴欣燕</td>
        </tr>
        <tr>
            <td id="15">陈梅香</td>
            <td id="16">陈立智</td>
            <td id="17">袁贵森</td>
            <td id="18">赵浩敏</td>
            <td id="19">林世涛</td>
            <td id="20">罗启恒</td>
            <td id="21">卢国建</td>
        </tr>
        <tr>
            <td id="22">黄柱菘</td>
            <td id="23">陈鹏</td>
            <td id="24">张耀仁</td>
            <td id="25">陈华伟</td>
            <td id="26">张正豪</td>
            <td id="27">韦仲晓</td>
            <td id="28">黄富贵</td>
        </tr>
        <tr>
            <td id="29">陆建锋</td>
            <td id="30">曾德森</td>
            <td id="31">吴文龙</td>
            <td id="32">陆利群</td>
            <td id="33">黄雄</td>
            <td id="34">王世财</td>
            <td id="35">张先杰</td>
        </tr>
        <tr>
            <td id="36">胡基耀</td>
            <td id="37">马鑫涛</td>
            <td id="38">李涛</td>
            <td id="39">杨凌翔</td>
            <td id="40">罗此东</td>
            <td id="41">唐皓颖</td>
            <td id="42">白婉婷</td>
        </tr>
    </table>
    <div style=" text-align: center; margin-top:10px;">
        <button onclick="start()">抽选幸运玩家</button>
        <span id="nu"></span>
    </div>
    <!-- <div><img src=".././" alt="" width="700"></div> -->
    <!-- <script>
        // setInterval:实现图片轮播
        var img = document.getElementsByTagName('img')[0]
        const imgArr=['1.jpg','2.jpg'];
        var count = 0;
        function fn1(){
            if(count<1){
                count++;
            }else{
                count = 0;
            }
            img.src = '.././' + imgArr[count];
        }
        setInterval(fn1,3000)
    </script> -->
</body>
</html>